<template>
  <div>
    <div class="head">
      <p class="text">今日更新</p>
      <van-icon
        @click="onClickLeft()"
        size="20"
        color="whitesmoke"
        name="arrow-left"
        class="icon"
      />
    </div>
    <br />
    <div v-if="ganggang.length !== 0">
      <span class="update_text">刚刚</span>
      <br />
      
      <div class="guess_like">
        <br />
        <div
          class="guess_like_show"
          v-for="(item, index) in ganggang"
          :key="index"
        >
          <van-image radius="10"
            class="guess_like_img"
            width="50"
            height="50"
            :src="item.app_image_road"
          />
          <span class="guess_like_sp1">{{ item.app_name }}</span>
          <span class="guess_like_sp2"
            >下载次数：{{ item.app_downloding_times }}</span
          >
          <van-button class="guess_like_small" size="small" round type="info"
            >下载</van-button
          >
        </div>
      </div>
    </div>
    <br />
    <div  v-if="minute.length !== 0">
      <span class="update_text">15分钟前</span><br />
      <br />
      <div class="guess_like">
        <br />
        <div
          class="guess_like_show"
          v-for="(item, index) in minute"
          :key="index"
        > 
          <van-image radius="10"
            class="guess_like_img"
            width="50"
            height="50"
            :src="item.app_image_road"
          />
          <span class="guess_like_sp1">{{ item.app_name }}</span>
          <span class="guess_like_sp2"
            >下载次数：{{ item.app_downloding_times }}</span
          >
          <van-button class="guess_like_small" size="small" round type="info"
            >下载</van-button
          >
        </div>
      </div>
      <br />
    </div>
    <div  v-if="hour.length !== 0">
      <span class="update_text">1个小时前</span><br />
      <br />
      <div class="guess_like">
        <br />
        <div class="guess_like_show" v-for="(item, index) in hour" :key="index">
          <van-image radius="10"
            class="guess_like_img"
            width="50"
            height="50"
            :src="item.app_image_road"
          />
          <span class="guess_like_sp1">{{ item.app_name }}</span>
          <span class="guess_like_sp2"
            >下载次数：{{ item.app_downloding_times }}</span
          >
          <van-button class="guess_like_small" size="small" round type="info"
            >下载</van-button
          >
        </div>
      </div>
    </div>
    <br />
    <div v-if="today.length !== 0">
      <span class="update_text">今天</span><br />
      <br />
      <div class="guess_like">
        <br />
        <div
          class="guess_like_show"
          v-for="(item, index) in today"
          :key="index"
        >
          <van-image radius="10"
            class="guess_like_img"
            width="50"
            height="50"
            :src="item.app_image_road"
          />
          <span class="guess_like_sp1">{{ item.app_name }}</span>
          <span class="guess_like_sp2"
            >下载次数：{{ item.app_downloding_times }}</span
          >
          <van-button class="guess_like_small" size="small" round type="info"
            >下载</van-button
          >
        </div>
      </div>
    </div>
    <br />
    <div v-if="yestoday.length !==0">
      <span class="update_text">昨天</span><br />
      <br />
      <div class="guess_like">
        <br />
        <div
          class="guess_like_show"
          v-for="(item, index) in yestoday"
          :key="index"
        >
          <van-image radius="10"
            class="guess_like_img"
            width="50"
            height="50"
            :src="item.app_image_road"
          />
          <span class="guess_like_sp1">{{ item.app_name }}</span>
          <span class="guess_like_sp2"
            >下载次数：{{ item.app_downloding_times }}</span
          >
          <van-button class="guess_like_small" size="small" round type="info"
            >下载</van-button
          >
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import http from '../api/index';
export default {
  data() {
    return {
      ganggang: [],
      minute: [],
      hour: [],
      today: [],
      yestoday: [],
    };
  },
  methods: {
    onClickLeft() {
      this.$router.push('/softGame');
    },
  },
  mounted() {
    http
      .getTodayUpdate({
        i: 1,
      })
      .then((r) => {
        console.log(r);
        this.ganggang = r.data;
      });
    //   15
    http
      .getTodayUpdate({
        i: 2,
      })
      .then((r) => {
        console.log(r);
        this.minute = r.data;
      });
    //   一小时
    http
      .getTodayUpdate({
        i: 3,
      })
      .then((r) => {
        console.log(r);
        this.hour = r.data;
      });
    //   一天
    http
      .getTodayUpdate({
        i: 4,
      })
      .then((r) => {
        console.log(r);
        this.today = r.data;
      });
    //   昨天
    http
      .getTodayUpdate({
        i: 5,
      })
      .then((r) => {
        console.log(r);
        this.yestoday = r.data;
      });
  },
};
</script>
<style scoped>
.head {
  width: 100%;
  height: 4rem;
  background-color: rgb(108, 144, 243);
}
.text {
  text-align: center;
  font-size: 1.6rem;
  color: whitesmoke;
  line-height: 4rem;
}
.icon {
  position: absolute;
  top: 1.1rem;
  /* left: 0px; */
}
.guess_like {
  width: 96%;
  margin: 0 auto;
  border-radius: 1.5rem;
  background-color: white;
}
.guess_text {
  position: relative;
}
.guess_text_sp1 {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  font-size: 1.6rem;
}
.guess_arrow {
  position: absolute;
  right: 1rem;
  top: 1.3rem;
  font-size: 2rem;
}
.guess_like_show {
  width: 96%;
  height: 6rem;
  position: relative;
  margin-top: 2rem;
}
.guess_like_img {
  position: absolute;
  top: 0px;
  left: 2rem;
  border-radius: 1rem;
}
.guess_like_sp1 {
  position: absolute;
  top: 0.1rem;
  left: 8.5rem;
  font-size: 1.8rem;
  color: #252525;
}
.guess_like_sp2 {
  position: absolute;
  top: 3rem;
  left: 8.5rem;
  font-size: 1.4rem;
  color: #7a7a7a;
}
.guess_like_small {
  position: absolute;
  top: 0.8rem;
  right: 0px;
  width: 7rem;
}
.update_text {
  font-size: 1.8rem;
  color: #252525;
  margin-left: 1rem;
}
</style>